home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
data
/
awkscrpt
/
loan.awk
< prev
next >
Wrap
Text File
|
1995-02-06
|
646b
|
42 lines
# 元利均等払い返済額の計算
# m:借入額[万円] r:年利[%] year:返済年数[年]
BEGIN {
m = 100
r = 4.35
year = 35
input()
calc()
}
{
input()
calc()
}
function input() {
printf("借入額(%d)[万円]:", m)
getline
m = $0 ? $0 + 0 : m
printf("年利(%.2f)[%]:", r)
getline
r = $0 ? $0 + 0 : r
printf("返済年数(%d)[年]:", year)
getline
year = $0 ? $0 + 0 : year
}
function calc() {
g0 = m * 10000
n = 12 * year
r12 = r / 1200
a = 1 + r12
an = beki(a,n)
k = g0 * an * r12 / (an - 1)
printf("\n月々の返済額は %.2f 円\n", k)
}
function beki(x,n ,y) {
y = n * log(x)
return exp(y)
}